package com.twu.biblioteca.processor;

import com.twu.biblioteca.controller.LibraryController;
import com.twu.biblioteca.controller.UserController;
import com.twu.biblioteca.model.User;
import com.twu.biblioteca.ui.LibraryView;
import com.twu.biblioteca.util.Messages;

/**
 * Created by madhu on 2/5/14.
 */
public class LoginMenuProcessor implements MenuProcessor {
    @Override
    public void processLibraryMenu(LibraryController libraryController) {
        if(!User.isLoggedIn()) new UserController().login();
        else {
            LibraryView libraryView = libraryController.getLibraryView();
            libraryView.displayErrorMessage(Messages.invalidLoginMessage);
        }
    }
}
